/*******************************************************************************
 * Copyright (c) 2007 University of Oslo.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University of Oslo - initial API and implementation
 *******************************************************************************/

package com.cea.papyrus.diagram.sequence.sedi.model.command;

import org.eclipse.gef.commands.Command;
import org.eclipse.uml2.uml.Interaction;

import com.cea.papyrus.diagraminterchange2.di2.Diagram;

/**
 * Command to add Interactions to sequence diagrams.
 * <p>
 * The following attributes must be set for the command to complete successfully:
 * </p>
 * <ul>
 * <li>Diagram
 * <li>Interaction
 * </ul>
 * 
 * @author frankd@ifi.uio.no
 * @see com.cea.papyrus.diagram.sequence.sedi.model.command.RemoveInteractionFromDiagramCommand
 */
public class AddInteractionToDiagramCommand extends Command {

    private Diagram diagram;
    private Interaction interaction;

    public AddInteractionToDiagramCommand() {
    }

    public AddInteractionToDiagramCommand(final Diagram d, final Interaction i) {
        setDiagram(d);
        setInteraction(i);
    }

    public void setDiagram(final Diagram diagram) {
        this.diagram = diagram;
    }

    public void setInteraction(final Interaction interaction) {
        this.interaction = interaction;
    }

    @SuppressWarnings("unchecked")
    @Override
    public void execute() {
        // diagram.getInteractions().add(interaction);
    }

    @Override
    public void undo() {
        // diagram.getInteractions().remove(interaction);
    }

    @Override
    public void dispose() {
        diagram = null;
        interaction = null;
    }
}
